/**
 * Created with IntelliJ IDEA.
 * User: olgak
 * Date: 2.5.2013
 * Time: 11:40
 * To change this template use File | Settings | File Templates.
 */
//All these functions are used in the view createQuestion.scala.html

$(document).ready(function(){
    $(".bookInfo").hide();
    //$(".show_hide").show();
    $('.show_hide').click(function(){
        $(".bookInfo").slideToggle();
    });
});

function addTextTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphText");
    var label=document.createElement("spanText");
    label.setAttribute("id","span6");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("class", "span6")
    element.setAttribute("id", "inputField");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("textTagBar");
    foo.appendChild(paragraph);
}

function removeTextTag(){
    var remove = document.getElementById("paragraphText");
    var foo = document.getElementById("textTagBar");
    //append element in page span
    foo.removeChild(remove);
}

function myFunction(val)
{
    var element=document.getElementById('questionText');

    if(val=='notext' || val=="")
        element.style.visibility = "hidden";
    else if(val='text')

        element.style.visibility = "visible";
}

function addNewKrossOption(){
    var label=document.createElement("p");
    label.setAttribute("id", "paragraphKrossOption");
    var element=document.createElement("input");
    element.setAttribute("type", "text");
    element.setAttribute("name", "svor_texti");
    element.setAttribute("class", "span6");
    element.setAttribute("placeholder", "Svarmöguleiki");
    var foo = document.getElementById("krossOptions");
    label.appendChild(element);
    //append element in page span
    foo.appendChild(label);
}

function removeKrossOption(){
    var remove = document.getElementById("paragraphKrossOption");
    var foo = document.getElementById("krossOptions");
    //append element in page span
    foo.removeChild(remove);
}

function addKrossTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphKross");
    var label=document.createElement("spanKross");
    label.setAttribute("id","span");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("id", "inputField");
    element.setAttribute("class", "span6");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("krossTagBar");
    foo.appendChild(paragraph);
}

function removeKrossTag(){
    var remove = document.getElementById("paragraphKross");
    var foo = document.getElementById("krossTagBar");
    //append element in page span
    foo.removeChild(remove);
}

function myFunction(val)
{
    var element=document.getElementById('questionText');

    if(val=='notext' || val=="")
        element.style.visibility = "hidden";
    else if(val='text')

        element.style.visibility = "visible";
}

function addNewFjolvalOption(){
    var label=document.createElement("p");
    label.setAttribute("id", "paragraphFjolvalOption");
    var selectRight= document.createElement("select");
    selectRight.name="rettsvar";
    var optionRight = document.createElement("option");
    var optionWrong=document.createElement("option");
    optionRight.text="Rétt svar";
    optionWrong.text="Rangt svar";
    optionRight.setAttribute("value", "rett");
    optionWrong.setAttribute("value", "rangt");
    var element=document.createElement("input");
    element.setAttribute("type", "text");
    element.setAttribute("name", "svor_texti");
    element.setAttribute("class", "span6");
    element.setAttribute("placeholder", "Svarmöguleiki");
    selectRight.appendChild(optionRight);
    selectRight.appendChild(optionWrong);
    label.appendChild(element);
    label.appendChild(selectRight);
    var foo = document.getElementById("fjolvalOptions");
    //append element in page span
    foo.appendChild(label);
    //foo.appendChild(element);
    //foo.appendChild(selectRight);
}
function removeFjolvalOption(){
    var remove = document.getElementById("paragraphFjolvalOption");
    var foo = document.getElementById("fjolvalOptions");
    //append element in page span
    foo.removeChild(remove);
}

function addFjolvalTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphFjolval");
    var label=document.createElement("spanFjolval");
    label.setAttribute("id","span");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("class", "span6");
    element.setAttribute("id", "inputField");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("fjolvalTagBar");
    foo.appendChild(paragraph);
}

function removeFjolvalTag(){
    var remove = document.getElementById("paragraphFjolval");
    var foo = document.getElementById("fjolvalTagBar");
    //append element in page span
    foo.removeChild(remove);
}

function myFunction(val)
{
    var element=document.getElementById('questionText');

    if(val=='notext' || val=="")
        element.style.visibility = "hidden";
    else if(val='text')

        element.style.visibility = "visible";
}

function addEydufyllingTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphEydufylling");
    var label=document.createElement("spanEydufylling");
    label.setAttribute("id","span");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("class", "span6");
    element.setAttribute("id", "inputField");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("eydufyllingTagBar");
    foo.appendChild(paragraph);
}

function removeEydufyllingTag(){
    var remove = document.getElementById("paragraphEydufylling");
    var foo = document.getElementById("eydufyllingTagBar");
    //append element in page span
    foo.removeChild(remove);
}

function myFunction(val)
{
    var element=document.getElementById('questionText');

    if(val=='notext' || val=="")
        element.style.visibility = "hidden";
    else if(val='text')

        element.style.visibility = "visible";
}

function addMyndTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphMynd");
    var label=document.createElement("spanMynd");
    label.setAttribute("id","span");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("class", "span6")
    element.setAttribute("id", "inputField");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("myndTagBar");
    foo.appendChild(paragraph);
}

function removeMyndTag(){
    var remove = document.getElementById("paragraphMynd");
    var foo = document.getElementById("myndTagBar");
    //append element in page span
    foo.removeChild(remove);
}

function addVidhengiTag(){
    var label1 = document.createTextNode("Leitarskilyrði\n");
    var paragraph = document.createElement("p");
    paragraph.setAttribute("id", "paragraphVidhengi");
    var label=document.createElement("spanText");
    label.setAttribute("id","span");
    label.appendChild(label1);
    var element=document.createElement("input");
    element.setAttribute("class", "span6")
    element.setAttribute("id", "inputField");
    element.setAttribute("type", "text");
    element.setAttribute("name", "spurningLeitarskilyrdi");
    element.setAttribute("list", "leitarskilyrdiList");
    paragraph.appendChild(label);
    paragraph.appendChild(element);
    var foo = document.getElementById("vidhengiTagBar");
    foo.appendChild(paragraph);
}

function removeVidhengiTag(){
    var remove = document.getElementById("paragraphVidhengi");
    var foo = document.getElementById("vidhengiTagBar");
    //append element in page span
    foo.removeChild(remove);
}




